<template>
    <div class="dcq-popup-container" style="width: auto;min-width:200px;" 
         v-if="popOption.visible" 
        :style="{ left: popOption.screenX + 'px', top: popOption.screenY + 'px' }">
        <div class="dcq-popup-container-body" style="padding:5px 8px;" v-if="popOption.farmNum>1">
                <div class="dcq-popup-container-body-row">
                    <div class="dcq-popup-container-body-row-label">农场数量：</div>
                    <div class="dcq-popup-container-body-row-value" >
                        {{ popOption.farmNum }}
                    </div>
                </div>
                <div class="dcq-popup-container-body-row">
                    <div class="dcq-popup-container-body-row-label">总面积：</div>
                    <div class="dcq-popup-container-body-row-value" >
                        {{ popOption.farmAreaTotal }}亩
                    </div>
                </div>
        </div>
        <div class="dcq-popup-container-body" style="padding:5px 8px;" v-else>
                <div class="dcq-popup-container-body-row">
                    <div class="dcq-popup-container-body-row-label">农场名称：</div>
                    <div class="dcq-popup-container-body-row-value" >
                        {{ popOption.title }}
                    </div>
                </div>
                <div class="dcq-popup-container-body-row">
                    <div class="dcq-popup-container-body-row-label">农场面积：</div>
                    <div class="dcq-popup-container-body-row-value" >
                        {{ popOption.farmAreaTotal }}亩
                    </div>
                </div>
        </div>
    </div>
</template>
<style lang="scss" scoped>
@import '../style/popup.scss';
</style>
<script setup>
import {ref,reactive,onMounted,watch} from "vue"
import { message } from '@/utils/element'
import useClipboard from 'vue-clipboard3';
const { toClipboard } = useClipboard();

const emits = defineEmits(['onClose'])
const props = defineProps({
    popOption:{
        type:Object,
        default(){return {}}
    }
})

function onClose() {
    emits('onClose', false)
}
const btnCopy = async (str) => {
    try {
        await toClipboard(str + '');
        message(`复制成功：${str}`,2)
    } catch (e) {
        message('复制失败',3);
    }
}

</script>